<%@page contentType="text/html" %>
<%@page pageEncoding="UTF-8" %>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j" %>
<%@taglib prefix="rich" uri="http://richfaces.org/rich" %>
<html>
<head>
    <title>Goodwill - Окружение</title>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <meta HTTP-EQUIV="Cache-Control" CONTENT="must-revalidate">
    <meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
    <meta HTTP-EQUIV="Cache-Control" CONTENT="no-store">
    <meta HTTP-EQUIV="Expires" CONTENT="0">

    <link rel="stylesheet" href="resources/css/main.css"/>
    <link rel="stylesheet" href="resources/css/stylesheet.css"/>

</head>
<body>
<f:view>
    <jsp:include page="status.jsp"/>

    <a4j:form id="jsForm" prependId="false">
        <a4j:jsFunction name="updateStatusPanel" reRender="panelMailerStatus,panelBackuperStatus,panelMailerStatus"/>
    </a4j:form>

    <h:form>
        <h:panelGroup layout="block" styleClass=""
                      style="border:1px solid black;background-color:wheat;padding:4px;margin:5px;width:500px;">
            <h:commandLink value="обновить" onclick="return false;"
                           style="font-size:100%;font-weight:bold;margin-left:5px"/>
        </h:panelGroup>

        <h:panelGroup layout="block" styleClass="" style="margin:5px">
            <h:outputText value="Контроль окружения" style="margin-top:10px;font-size:140%;font-weight:bold"/>
        </h:panelGroup>

        <h:panelGroup layout="block" styleClass="" style="margin:5px">
            <h:panelGrid columns="2" cellpadding="5" cellspacing="5">
                <h:panelGroup>
                    <h:outputText value="Робот рассылки" style="margin-top:5px;font-size:120%;font-weight:bold"/><br>
                    <h:outputText value=""
                                  style="margin-left:60px;font-size:90%;color:dimgray;font-family:Trebuchet MS,serif"/>
                </h:panelGroup>
                <h:panelGroup id="panelMailerStatus">
                    <h:outputText value="модуль запущен" rendered="#{EnviromentControlBean.mailerRunning}"
                                  style="font-weight:bold;color:green;font-size:90%"/>
                    <h:outputText value="модуль остановлен" rendered="#{!EnviromentControlBean.mailerRunning}"
                                  style="font-weight:bold;color:red;font-size:90%"/>
                    <h:commandLink value="запустить" rendered="#{!EnviromentControlBean.mailerRunning}"
                                   action="#{EnviromentControlBean.startMailer}" style="margin-left:20px"/>
                    <h:commandLink value="остановить" rendered="#{EnviromentControlBean.mailerRunning}"
                                   action="#{EnviromentControlBean.stopMailer}" style="margin-left:20px"/>
                </h:panelGroup>
                <h:panelGroup>
                    <h:outputText value="Архивация" style="margin-top:5px;font-size:120%;font-weight:bold"/><br>
                    <%--<h:outputText value="Дата последней архивации данных: #{EnviromentControlBean.lastBackupDate}" style="margin-left:60px;font-size:90%;color:dimgray;font-family:Trebuchet MS,serif"/>--%>
                </h:panelGroup>
                <h:panelGroup id="panelBackuperStatus">
                    <h:outputText value="модуль запущен" rendered="#{EnviromentControlBean.backupsRunning}"
                                  style="font-weight:bold;color:green;font-size:90%"/>
                    <h:outputText value="модуль остановлен" rendered="#{!EnviromentControlBean.backupsRunning}"
                                  style="font-weight:bold;color:red;font-size:90%"/>
                    <h:commandLink value="запустить" rendered="#{!EnviromentControlBean.backupsRunning}"
                                   action="#{EnviromentControlBean.startBackups}" style="margin-left:20px"/>
                    <h:commandLink value="остановить" rendered="#{EnviromentControlBean.backupsRunning}"
                                   action="#{EnviromentControlBean.stopBackups}" style="margin-left:20px"/>
                </h:panelGroup>
                <h:panelGroup>
                    <h:outputText value="Интеграция с 1С" style="margin-top:5px;font-size:120%;font-weight:bold"/><br>
                    <%--<h:outputText value="Дата последнего обмена с 1С: #{EnviromentControlBean.last1CExchangeDate}" style="margin-left:60px;font-size:90%;color:dimgray;font-family:Trebuchet MS,serif"/>--%>
                </h:panelGroup>
                <h:panelGroup id="panel1CStatus">
                    <h:outputText value="модуль запущен" rendered="#{EnviromentControlBean.c1Running}"
                                  style="font-weight:bold;color:green;font-size:90%"/>
                    <h:outputText value="модуль остановлен" rendered="#{!EnviromentControlBean.c1Running}"
                                  style="font-weight:bold;color:red;font-size:90%"/>
                    <h:commandLink value="запустить" rendered="#{!EnviromentControlBean.c1Running}"
                                   action="#{EnviromentControlBean.startC1}" style="margin-left:20px"/>
                    <h:commandLink value="остановить" rendered="#{EnviromentControlBean.c1Running}"
                                   action="#{EnviromentControlBean.stopC1}" style="margin-left:20px"/>
                </h:panelGroup>
                <h:panelGroup>
                    <h:outputText value="Протоколирование" style="margin-top:5px;font-size:120%;font-weight:bold"/><br>
                </h:panelGroup>
                <h:panelGroup>
                    <h:outputText value="модуль запущен" rendered="#{EnviromentControlBean.h2Running}"
                                  style="font-weight:bold;color:green;font-size:90%"/>
                    <h:outputText value="модуль остановлен" rendered="#{!EnviromentControlBean.h2Running}"
                                  style="font-weight:bold;color:red;font-size:90%"/>
                    <h:commandLink value="запустить" rendered="#{!EnviromentControlBean.h2Running}"
                                   action="#{EnviromentControlBean.startH2}" style="margin-left:20px"/>
                    <h:commandLink value="остановить" rendered="#{EnviromentControlBean.h2Running}"
                                   action="#{EnviromentControlBean.stopH2}" style="margin-left:20px"/>
                    <h:commandLink value="сделать бэкап" action="#{EnviromentControlBean.backupH2}"
                                   style="margin-left:20px"/>
                </h:panelGroup>
            </h:panelGrid>
        </h:panelGroup>
    </h:form>
</f:view>
</body>
<head>
    <meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <meta HTTP-EQUIV="Cache-Control" CONTENT="must-revalidate">
    <meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
    <meta HTTP-EQUIV="Cache-Control" CONTENT="no-store">
    <meta HTTP-EQUIV="Expires" CONTENT="0">
</head>
</html>
